#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

struct TreeNode {
    struct TreeNode* left;
    struct TreeNode* right;
    char val;
};

struct TreeNode* CreateTree(char* a, int* pi) {
    if (a[*pi] == '#') {
        (*pi)++;
        return NULL;
    }
    struct TreeNode* root = (struct TreeNode*)malloc(sizeof(struct TreeNode));
    root->val = a[*pi];
    (*pi)++;
    root->left = CreateTree(a, pi);
    root->right = CreateTree(a, pi);
    return root;
}

void InOrder(struct TreeNode* root) {
    if (root == NULL)
        return;
    InOrder(root->left);
    printf("%c ", root->val);
    InOrder(root->right);
}

int main() 
{
    char a[100];
    scanf("%s", a);
    int i = 0;
    struct TreeNode* root = CreateTree(a, &i);
    InOrder(root);
    return 0;
}